const mongoose = require("mongoose");
mongoose.pluralize(null); //去掉集合后面的s
const { Schema, model } = mongoose;
const versionKey = { versionKey: false };
const moment = require("moment");
moment.locale("zh-cn");

// 四个推荐游记表
const FourTravelSchema = new Schema(
    {
      imageUrl: String, //封面图
      travel_id: {
        //关联游记表的_id
        type: mongoose.Types.ObjectId,
        ref: "usertravel",
        required: true,
      },
      time: {
        type: String,
        default: moment().utcOffset(8).format("YYYY-MM-DD"),
      },
      timestamp: {
        type: Number,
        default: () => moment().unix(),
      },
    },
    versionKey
  );

  module.exports = {
    modelFourTravel: model("fourtravel", FourTravelSchema),
  };
  